package com.stylefeng.guns.generator.engine.config;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * Mapper模板生成的配置
 *
 * @author fengshuonan
 * @date 2017-05-07 22:12
 */
@Data
public class MapperConfig {

    private ContextConfig contextConfig;

    private String mapperPathTemplate;
    private String packageName;//包名称
    private List<String> imports;//所引入的包

    public void init() {
        ArrayList<String> imports = new ArrayList<>();

        imports.add("com.baomidou.mybatisplus.mapper.BaseMapper");
        imports.add("com.baomidou.mybatisplus.plugins.Page");
        imports.add("com.stylefeng.guns.common.persistence.model." + contextConfig.getEntityName());
        imports.add("org.apache.ibatis.annotations.Param");
        imports.add("java.util.List");
        imports.add("java.util.Map");

        this.imports = imports;
        this.packageName = contextConfig.getModelMapperPackageName();
        this.mapperPathTemplate = "\\src\\main\\java\\" + contextConfig.getModelMapperPackageName().replaceAll("\\.", "\\\\") + "\\" + contextConfig.getEntityName() + "Mapper.java";
    }

}
